package com.zhang.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * 客户实体
 */
@Entity
@Table(name = "t_customer")
public class  Customer {

	@Id
	@GeneratedValue
	@ExcelProperty("编号")
	private Integer id; // 编号

	@Column(length = 200)
	@ExcelProperty("供应商名称")
	private String name; // 供应商名称

	@Column(length = 50)
	@ExcelProperty("联系人")
	private String contact; // 联系人

	@Column(length = 50)
	@ExcelProperty("联系电话")
	private String number; // 联系电话

	@Column(length = 300)
	@ExcelProperty("联系地址")
	private String address; // 联系地址

	@Column(length = 1000)
	@ExcelProperty("备注")
	private String remarks; // 备注

	@Temporal(TemporalType.TIMESTAMP)  //同时映射日期和时间部分,jpa中注解
	@ExcelIgnore //默认所有字段都会和excel去匹配，加了这个注解会忽略该字段
	private Date createTime =  new Date();

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getContact() {
		return contact;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	/**
	 * @return the createTime
	 */
	@JsonSerialize(using=CustomDateTimeSerializer.class)
	public Date getCreateTime() {
		return createTime;
	}

	/**
	 * @param createTime
	 *            the createTime to set
	 */
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Override
	public String toString() {
		return "[id=" + id + ", name=" + name + ", contact=" + contact + ", number=" + number + ", address=" + address + ", remarks=" + remarks
				+ ", createTime=" + createTime + "]";
	}

}
